package mappedClass;

// Generated 3 juil. 2014 12:40:01 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Usertask generated by hbm2java
 */
@Entity
@Table(name = "usertask", catalog = "test", uniqueConstraints = @UniqueConstraint(columnNames = {
		"userId", "taskId" }))
public class UserTask implements java.io.Serializable {

	private UserTaskId id;
	private Task task;
	private User user;
	private Set<TaskDailyReporting> taskdailyreportings = new HashSet<TaskDailyReporting>(0);

	public UserTask() {
	}

	public UserTask(UserTaskId id, Task task, User user) {
		this.id = id;
		this.task = task;
		this.user = user;
	}

	public UserTask(UserTaskId id, Task task, User user, Set<TaskDailyReporting> taskdailyreportings) {
		this.id = id;
		this.task = task;
		this.user = user;
		this.taskdailyreportings = taskdailyreportings;
	}

	@EmbeddedId
    @AttributeOverrides({
                    @AttributeOverride(name = "taskId", column = @Column(name = "taskId", nullable = false)),
                    @AttributeOverride(name = "userId", column = @Column(name = "userId", nullable = false)) })
    public UserTaskId getId() {
            return this.id;
    }

    public void setId(UserTaskId id) {
            this.id = id;
    }
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "taskId", nullable = false, insertable = false, updatable = false)
	public Task getTask() {
		return this.task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@OneToMany(fetch = FetchType.LAZY)
	public Set<TaskDailyReporting> getTaskdailyreportings() {
		return this.taskdailyreportings;
	}

	public void setTaskdailyreportings(Set<TaskDailyReporting> taskdailyreportings) {
		this.taskdailyreportings = taskdailyreportings;
	}

	@Override
	public String toString() {
		return "UserTask [task=" + task + ", user=" + user
				+ ", taskdailyreportings=" + taskdailyreportings;
	}

}
